Hash Table: The Basic Idea

A hash table uses a hash function to compute an index, or "slot", from a key. This allows for direct access to records, achieving O(1) average time complexity.

Hash Function \(h(k)\)

1. hashCode = sum(charCodes(k))

2. index = hashCode % 10

Interactive Demo

Log: